package com.atguigu.springcloud.Controller;

import com.atguigu.springcloud.Pojo.Payment;
import com.atguigu.springcloud.ResponseBody.Body;
import com.atguigu.springcloud.Service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

//    添加数据
    @RequestMapping(value = "addPayment",method = RequestMethod.POST)
    public Body addPayment(@RequestBody Payment payment){
        Body body = paymentService.addPayment(payment);
        return body;
    }

//    查询数据
    @RequestMapping(value = "queryPayment",method = RequestMethod.GET)
    public Body<Payment> queryPayment(@RequestParam("id") long id){
        Body body = paymentService.queryPayment(id);
        return body;
    }
}
